package com.czl.module_storehouse.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.module_base.utils.NumberUtils;
import com.czl.module_storehouse.R;
import com.czl.module_storehouse.bean.StorageRecordBean;

import java.util.List;

/**
 * @author xubin
 */
public class WarehouseRecordAdapter extends BaseQuickAdapter<StorageRecordBean, BaseViewHolder> {

    public WarehouseRecordAdapter(int layoutResId, @Nullable List<StorageRecordBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, StorageRecordBean item) {
        helper.setText(R.id.tv_record_name, item.getStorageModelStr())
                .setText(R.id.tv_record_date, item.getStorageDateStr())
                .setText(R.id.tv_record_code, "入库单：" + item.getStorageCode())
                .setText(R.id.tv_record_count, "数量：" + item.getStorageNum())
                .setText(R.id.tv_record_price, "金额：" + NumberUtils.decimalPoints(item.getPrice()))
                .setText(R.id.tv_supplier, "供应商：" + item.getSupplier());
    }
}
